package com.hmall.api.interceptor;

import com.hmall.common.utils.UserContext;
import feign.RequestInterceptor;
import feign.RequestTemplate;


public class FeignInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        Long loginUserId = UserContext.getUser();
        if(loginUserId != null){
            requestTemplate.header("user-info", String.valueOf(loginUserId));
        }
    }
}
